const morgan = require("morgan");
const fs = require("fs");
const { ENV } = require("../../config");
const { resolve } = require("path");

module.exports = (app) => {
    if (ENV === "production") {
        app.use(
            morgan("combined", {
                stream: fs.createWriteStream(
                    resolve(__dirname, "../../logs/access.log"),
                    { flags: "a" }
                )
            })
        );
    }
};
